﻿Imports System.Data.OleDb
Public Class profile
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not IsPostBack Then
            Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
            Dim SqlString As String = "select * from profiles where wlUsername = @f1"
            Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)
            cmd.CommandType = CommandType.Text
            cmd.Parameters.AddWithValue("@f1", User.Identity.Name)
            oleDbConn.Open()

            Dim dr As OleDbDataReader = cmd.ExecuteReader()

            If dr.HasRows Then
                dr.Read()
                If Not IsDBNull(dr("Name")) Then lblNames.Text = dr("Name")
                If Not IsDBNull(dr("Age")) Then lblAge.Text = dr("Age")
                If Not IsDBNull(dr("Sex")) Then cblGender.SelectedValue = dr("Sex")
                If Not IsDBNull(dr("Picture")) Then imgMyPicture.ImageUrl = dr("Picture")
                If Not IsDBNull(dr("Description")) Then lblDescription.Text = dr("Description")
                If Not IsDBNull(dr("Location")) Then lblLocation.Text = dr("Location")
                If Not IsDBNull(dr("Weight")) Then lblWeight.Text = dr("Weight")
                If Not IsDBNull(dr("Height")) Then lblHeight.Text = dr("Height")
                If Not IsDBNull(dr("targetWeight")) Then lblTargetWeight.Text = dr("targetWeight")
                If Not IsDBNull(dr("emailAddress")) Then lblEmail.Text = dr("emailAddress")
                If Not IsDBNull(dr("Website")) Then lblWebsite.Text = dr("Website")
                If Not IsDBNull(dr("bgColor")) Then lblbgColor.Text = dr("bgColor")
                If Not IsDBNull(dr("bgColor")) Then ProfileDIV.Style("background-color") = dr("bgColor")
            End If
        End If
    End Sub

    'Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnEditProfile.Click
    'Response.Redirect("editprofile.aspx")
    'End Sub
End Class